package webmarket.common;

/**
 * 
 * 
 *
 */
public class ValidationObject {
	private String name;
	private String value;
	private Class<?> valuetype;
	private String infotype;
	private String msg;

	public static ValidationObject info(String name, String msg) {
		return new ValidationObject(name, "info", msg);
	}

	public static ValidationObject warning(String name, String value, Class<?> valuetype, String msg) {
		return new ValidationObject(name, value, valuetype, "warning", msg);
	}

	public static ValidationObject error(String name, String value, Class<?> valuetype) {
		return new ValidationObject(name, value, valuetype, "error");
	}

	public static ValidationObject success(String name, String msg) {
		return new ValidationObject(name, "success", msg);
	}

	public static ValidationObject error(String name, String msg) {
		return new ValidationObject(name, "error", msg);
	}

	public static ValidationObject warning(String name, String msg) {
		return new ValidationObject(name, "warning", msg);
	}

	private ValidationObject(String name, String infotype, String msg) {
		this.name = name;
		this.infotype = infotype;
		this.msg = msg;
	}

	private ValidationObject() {
	}

	private ValidationObject(String name, String value, Class<?> valuetype, String infotype) {
		this.name = name;
		this.value = value;
		this.valuetype = valuetype;
		this.infotype = infotype;
	}

	private ValidationObject(String name, String value, Class<?> valuetype, String infotype, String msg) {
		this(name, value, valuetype, infotype);
		this.msg = msg;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the value
	 */
	public String getValue() {
		return value;
	}

	/**
	 * @param value
	 *            the value to set
	 */
	public void setValue(String value) {
		this.value = value;
	}

	/**
	 * @return the type
	 */
	public Class<?> getType() {
		return valuetype;
	}

	/**
	 * @param type
	 *            the type to set
	 */
	public void setType(Class<?> type) {
		this.valuetype = type;
	}

	/**
	 * @return the infotype
	 */
	public String getInfotype() {
		return infotype;
	}

	/**
	 * @return the msg
	 */
	public String getMsg() {
		return msg;
	}

	/**
	 * @param msg
	 *            the msg to set
	 */
	public void setMsg(String msg) {
		this.msg = msg;
	}

}
